package com.tudouji.project.organization.service.impl;

import java.util.List;

import com.tudouji.project.organization.domain.vo.DepartmentVo;
import com.tudouji.project.organization.service.IDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tudouji.project.organization.mapper.DepartmentMapper;
import com.tudouji.project.organization.domain.Department;

/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author tudouji
 * @date 2021-01-29
 */
@Service
public class DepartmentServiceImpl implements IDepartmentService
{
    @Autowired
    private DepartmentMapper departmentMapper;

    /**
     * 查询【请填写功能名称】
     * 
     * @param guid 【请填写功能名称】ID
     * @return 【请填写功能名称】
     */
    @Override
    public Department selectDepartmentById(String guid)
    {
        return departmentMapper.selectDepartmentById(guid);
    }

    @Override
    public Department selectDepartmentByAutoId(Long id)
    {
        return departmentMapper.selectDepartmentByAutoId(id);
    }

    /**
     * 查询【请填写功能名称】列表
     * 
     * @param department 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<Department> selectDepartmentList(Department department)
    {
        return departmentMapper.selectDepartmentList(department);
    }
    @Override
    public List<DepartmentVo> findOrg(Department department)
    {
        return departmentMapper.findOrg(department);
    }

    /**
     * 新增【请填写功能名称】
     * 
     * @param department 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertDepartment(Department department)
    {
        return departmentMapper.insertDepartment(department);
    }

    /**
     * 修改【请填写功能名称】
     * 
     * @param department 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateDepartment(Department department)
    {
        return departmentMapper.updateDepartment(department);
    }

    public int on(String guid)
    {
        Department department = departmentMapper.selectDepartmentById(guid);
        if (1 == department.getStatus()) {
            department.setStatus(0);
        }else{
            department.setStatus(1);
        }
        return departmentMapper.updateDepartment(department);
    }

    /**
     * 批量删除【请填写功能名称】
     * 
     * @param guids 需要删除的【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteDepartmentByIds(String[] guids)
    {
        return departmentMapper.deleteDepartmentByIds(guids);
    }

    /**
     * 删除【请填写功能名称】信息
     * 
     * @param guid 【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteDepartmentById(String guid)
    {
        return departmentMapper.deleteDepartmentById(guid);
    }
}
